package com.atguigu.gulimall.cart.feign.fallback;

import com.atguigu.common.exception.BizCodeEnum;
import com.atguigu.common.exception.RRException;
import com.atguigu.common.utils.R;
import com.atguigu.gulimall.cart.feign.ProductFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.List;

@Slf4j
@Component
public class ProductFeignServiceFallBack implements ProductFeignService {
    @Override
    public R getSkuInfo(Long skuId) {
        log.info("调用熔断方法：getSkuInfo");
        return R.error(BizCodeEnum.COMMON_TO_MANY_REQUEST_EXCEPTION);
    }

    @Override
    public List<String> getSkuSaleAttrValues(Long skuId) {
        log.info("调用熔断方法：getSkuSaleAttrValues");
        throw new RRException(BizCodeEnum.COMMON_TO_MANY_REQUEST_EXCEPTION);
    }

    @Override
    public BigDecimal getPrice(Long skuId) {
        log.info("调用熔断方法：getPrice");
        throw new RRException(BizCodeEnum.COMMON_TO_MANY_REQUEST_EXCEPTION);
    }
}
